package com.itheima.service.impl;

import com.alibaba.dubbo.config.annotation.Service;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;

import com.itheima.dao.ParaDao;
import com.itheima.entity.PageResult;
import com.itheima.pojo.Brand;
import com.itheima.pojo.Para;

import com.itheima.service.ParaService;
import org.springframework.beans.factory.annotation.Autowired;


@Service(interfaceClass = ParaService.class)
public class ParaServiceImpl implements ParaService {
    @Autowired
    private ParaDao paraDao;

    @Override
    public PageResult findPage(Integer page, Integer size, String name, String options,Integer templateId) {
        PageHelper.startPage(page, size);
        Page<Brand> pages = paraDao.findPage(name, options,templateId);
        return new PageResult(pages.getTotal(), pages.getResult());
    }

    @Override
    public void add(Para para) {
        paraDao.add(para);
    }

    @Override
    public Para findById(Integer id) {
        return paraDao.findById(id);

    }

    @Override
    public void update(Para para) {
        paraDao.update(para);
    }

    @Override
    public void delete(Integer id) {
        paraDao.delete(id);
    }


}
